Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@rollup-extras/utils
Advanced tools
Utils to support the development of rollup plugins.
Disclaimer: It is not a substitute for the @rollup/pluginutils
package.
npm install --save-dev @rollup-extras/utils
function getOptions<T extends string | string[] | undefined | Record<string, unknown>, D, F extends DefaultsFactory<Partial<{[K in C]: string[]}> & Partial<Exclude<T, SimpleOptions>>>, C extends string>(options: T | undefined, defaults: D | undefined, field: C, factory?: F);
Utility function to get options object.
options
- object passed to the plugin, can be string
, string[]
or undefined
(applied second)defaults
- defaults (applied first)factory
- additional factories (applied last)field
- string
to set a property in case options is string
or string[]
, if options[field]
is string
it will be converted to string[]
Utility to construct a plugin that should/can be executed when multiple configs are used to gather information for the plugin.
function multiConfigPluginBase(useWriteBundle: boolean, pluginName: string, execute: ExecuteFn): Partial<PluginHooks>
useWriteBundle
- truthy if execute
function should be executed on the last writeBundle
, falsy if it should be executed on generateBundle
pluginName
- plugin nameexecute
- function to executeReturns a plugin instance.
Utility to construct a collector of data that reports count if verbose / more than 5 items. The assumption is that in case of verbose an external logger will take care of reporting. It is very niche and probably you don't need it. The main idea for this is that in case we report thousands of files we are not holding data in memory but discarding it / writing it to log.
function statistics(verbose: boolean, messageFactory: (result: number | string[]) => string): (name?: string) => undefined | string
Returns a collector that accepts new data if you pass a non-null/non-undefined parameter or constructs a message using the message factory.
type SimpleOptions = string | string[] | undefined;
type DefaultsFactory<T extends {[key: string]: unknown}> = {
[key: string]: ((options: T | undefined, field: string) => unknown);
}
type Result<T extends {[key: string]: unknown}, F extends DefaultsFactory<T>> = T & {
[key in keyof F]: F[key] extends ((options: T | undefined, field: string) => unknown) ? ReturnType<F[key]> : unknown;
}
FAQs
Utils to support creation of rollup plugins.
The npm package @rollup-extras/utils receives a total of 422 weekly downloads. As such, @rollup-extras/utils popularity was classified as not popular.
We found that @rollup-extras/utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.